#ifndef AUTOFORM_H
#define AUTOFORM_H

#include <QStyledItemDelegate>
#include <QWidget>
#include "touchbutton.h"
#include "window.h"
//#include <voiceanimation.h>
//#include <voicerecognition.h>
#include "custom/directioncontrolwidget.h"
#include"custom/turncontroller.h"

namespace Ui {
class Auto_Form;
}

class AutoForm : public QWidget
{
    Q_OBJECT

public:
    explicit AutoForm(QWidget *parent = nullptr);
    ~AutoForm();


protected:
    void resizeEvent(QResizeEvent* event) override;
    void mousePressEvent(QMouseEvent* event) override;
    void mouseReleaseEvent(QMouseEvent* event) override;
    void setupUI();
    void updateRecordState();
    void resetWndRect();

private slots:
    void onDirectionChanged(double x, double y);
    void onTurnChanged(double x);
    void on_upper_limb_btn_clicked();
    void on_global_cmd_btn_clicked();
    void on_audio_file_btn_clicked();
    void onAddWndBtnClick();
    void removeWindow(Window * pWnd);
    void setWindowMax(Window * pWnd);

public slots:
    void onShowTempratureWarn(QList<QString> str);

private:
    void scaleWidgets(QWidget *widget, double xScale,double yScale);
    void updateDirectionControllerPosition();
    void updateTurnControllerPosition();
    void clearWnd();
    void addWnd(int nID);
    Ui::Auto_Form *ui;
    DirectionControlWidget* m_directionCtrl;
    TurnController* m_turnCtrl;
    //VoiceAnimation*m_pVoiceAnim=nullptr;
    TouchButton * m_pAddWndBtn;
    TouchButton * m_pStartBtn;
    TouchButton * m_pStopBtn;
    //子窗口列表
    QList<Window *> m_lsWnd;

    QMap<int,QString> m_lsNoShowWnd;
    // QWidget interface

    // QWidget interface
protected:
    void showEvent(QShowEvent *event);
};

#endif // AUTOFORM_H
